package com.project.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.EmailBean;
import com.project.bean.UserBean;
import com.project.mapper.IUserMapper;
import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class UserServiceImpl implements IUserService {
    @Autowired
    private IUserMapper userMapper;
    @Override
    public UserBean login(String userName, String pwd) {
        QueryWrapper<UserBean> wrapper = new QueryWrapper<>();

            wrapper.eq("u_name",userName);
            wrapper.eq("u_pwd",pwd);

        return userMapper.selectOne(wrapper);
    }

    @Override
    public IPage<UserBean> cutAllUser(Integer pageNO) {
        return userMapper.selectPage(new Page<>(pageNO,3),null);
    }

    @Override
    public EmailBean findEmailById(Integer id) {

        return null;
    }
}
